package com.dd.ljzapplication.activity;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.LinearLayout;

import com.dd.ljzapplication.R;
import com.dd.ljzapplication.fragment.FourFragment;
import com.dd.ljzapplication.fragment.OneFragment;
import com.dd.ljzapplication.fragment.ThreeFragment;
import com.dd.ljzapplication.fragment.TwoFragment;

import java.util.ArrayList;

import base.BaseUtilActivity;

/**
 * Created by LiJZ on 2016/10/10.
 * 沉浸式状态栏
 */
public class BarActivity extends BaseUtilActivity {

	private ViewPager mViewPager;
	private ArrayList<Fragment> mListData;
	private LinearLayout mRootView;

	@Override
	protected int setLayoutID() {
		return R.layout.activity_baractivity;
	}

	@Override
	protected void initView() {
		mRootView = (LinearLayout) findViewById(R.id.rootview);
		mViewPager = (ViewPager) findViewById(R.id.vp);

		mListData = new ArrayList<>();
		mListData.add(new OneFragment());
		mListData.add(new TwoFragment());
		mListData.add(new ThreeFragment());
		mListData.add(new FourFragment());

		mViewPager.setAdapter(new MyAdapter(getSupportFragmentManager()));


	}

	public View getRootView() {
		return mRootView;
	}

	@Override
	protected void initEvent() {

	}

	@Override
	protected void initActionBar() {

	}

	@Override
	protected void init() {


	}

	private class MyAdapter extends FragmentPagerAdapter {

		public MyAdapter(FragmentManager fm) {
			super(fm);
		}

		@Override
		public Fragment getItem(int position) {
			return mListData.get(position);
		}

		@Override
		public int getCount() {
			return mListData.size();
		}
	}
}
